<?php
/**
 *
 * @author 天意
 * @version 1.0
 * @package Regsiter
 * @see 寄存器
 */

class Regsiter{
	private static $_instance =  array(); #命名空间存放区
	private $_mem = array(); #内存存储区
	private function __construct(){

	}
	public static function getInterface($namespace='methodwork'){
		if(!isset(self::$_instance[$namespace]))
		{
			$c=__CLASS__;
			self::$_instance[$namespace]=new $c;
		}
		return self::$_instance[$namespace];
	}
	public function get($key){
		if(isset($this->_mem[$key])){
			return $this->_mem[$key];
		}
	}
	public function set($key,$value){
		$this->_mem[$key] = $value;
	}
	public function __clone()
	{
		throw new RegsiterException('复制不被允许');
	}
	public static function getInterfaceAll(){
		return (self::$_instance);
	}
	public static function getInterfaceCount(){
		return count(self::$_instance);
	}
}
class RegsiterException extends DingException{
}